package pcsr.drivers.epuckDriver.command;

public interface IePuckUartProtocol {

	public static char COMMAND_TERMINATOR = '\r';
	public static char COMMAND_PARAMETER_SEPARATOR = ',';

	public class Action
	{
		public static final char ACCELEROMETER = 'a'; 		// Accelerometer
		public static final char BODY_LED = 'b'; 			// Body led 0=off 1=on 2=inverse
		public static final char SELECTOR = 'c'; 			// Selector position
		public static final char SET_MOTOR_SPEED = 'd';		// Set motor speed left,right
		public static final char GET_MOTOR_SPEED = 'e'; 	// Get motor speed left,right
		public static final char FRONT_LED = 'f'; 			// Front led 0=off 1=on 2=inverse
		public static final char IR_RECEIVER = 'g'; 		// IR receiver
		public static final char HELP = 'h'; 				// help
		public static final char GET_CAMERA = 'i'; 			// Get camera parameter
		public static final char SET_CAMERA = 'j'; 			// Set camera parameter mode,width,heigth,zoom(1,4 or 8)
		public static final char CALIBRATE_SENSORS = 'k'; 	// Calibrate proximity sensors
		public static final char LED = 'l'; 				// Led number,0=off 1=on 2=inverse
		public static final char FLOOR_SENSOR = 'm'; 		// Floor sensors
		public static final char PROXIMITY = 'n'; 			// Proximity
		public static final char LIGHT = 'o'; 				// Light sensors
		public static final char SET_MOTOR_POSITION = 'p'; 	// Set motor position left,right
		public static final char GET_MOTOR_POSITION = 'q'; 	// Get motor position left,right
		public static final char RESET = 'r'; 				// Reset e-puck
		public static final char STOP = 's'; 				// Stop e-puck and turn off leds
		public static final char PLAY_SOUND = 't'; 			// Play sound 1-5 else stop sound
		public static final char MICROPHONE = 'u'; 			// Get microphone amplitude
		public static final char VERSION = 'v'; 			// Version of SerCom
	}

	public enum LedStatus
	{
		OFF(0),
		ON(1),
		INVERSE(2);
		
		private final int id;
		LedStatus(int id) {
			this.id = id;
		}
		public int ID()   { return id; }
		public char Value() { return (char) ('0'+id); }
		public static LedStatus GetByValue(int enumvalue)
		{
			if(OFF.ID() == enumvalue)
			{
				return OFF;
			}
			if(ON.ID() == enumvalue)
			{
				return ON;
			}
			if(INVERSE.ID() == enumvalue)
			{
				return INVERSE;
			}
			return null;
		}
	}
	public enum LedNumber
	{
		ALL_LEDS(0),
		LED_1(1),
		LED_2(2),
		LED_3(3),
		LED_4(4),
		LED_5(5),
		LED_6(6),
		LED_7(7),
		LED_8(8),
		FRONT(9),
		BODY(10);

		private final int id;
		LedNumber(int id) {
			this.id = id;
		}
		public int ID()   { return id; }
		public char Value() { return (char) ('0'+id); }
	}

	public enum ProximityNumber
	{
		PROXIMITY_1(1),
		PROXIMITY_2(2),
		PROXIMITY_3(3),
		PROXIMITY_4(4),
		PROXIMITY_5(5),
		PROXIMITY_6(6),
		PROXIMITY_7(7),
		PROXIMITY_8(8);

		private final int id;
		ProximityNumber(int id) {
			this.id = id;
		}
		public int ID()   { return id; }
		public char Value() { return (char) (id); }
	}
	
	public enum Sounds {
		SOUND_1(1),
		SOUND_2(2),
		SOUND_3(3),
		SOUND_4(4),
		SOUND_5(5);

		private final int id;
		Sounds(int id) {
			this.id = id;
		}
		public int ID()   { return id; }
		public char Value() { return (char) ('0'+id); }
	}
}
